import request from '@/utils/request'

const role_url = '/sys/role'

// 获取所有角色列表
export const getRoleAPI = params =>
  request({
    url: role_url,
    params
  })

// 根据ID获取角色详情
export const getRoleInfoAPI = id =>
  request({
    url: `${role_url}/${id}`
  })

// 根据ID删除角色
export const delRoleAPI = id =>
  request({
    url: `${role_url}/${id}`,
    method: 'DELETE'
  })

// 根据ID更新角色
export const editRoleAPI = (id, data) =>
  request({
    url: `${role_url}/${id}`,
    method: 'PUT',
    data
  })

// 添加角色
export const addRoleAPI = data =>
  request({
    url: role_url,
    method: 'post',
    data
  })

// 给角色分配权限
export const assignRoleAPI = data =>
  request({
    method: 'put',
    url: role_url + '/assignPrem',
    data
  })

// 获取公司信息
export const getCompanyInfoAPI = id =>
  request({
    url: `/company/${id}`
  })
